package org.mock.controller;

import lombok.AllArgsConstructor;
import org.mock.common.R;
import org.mock.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import org.mock.entity.BaifenhuiNotice;
import org.mock.dto.BaifenhuiNoticeDTO;

import org.mock.service.BaifenhuiNoticeService;

/**
 * 
 *
 * @author AI
 * @since 2025-05-22
 */
@RestController
@AllArgsConstructor
@RequestMapping("baifenhuiNotice")
public class BaifenhuiNoticeController {

	private BaifenhuiNoticeService baifenhuiNoticeService;

	/**
	 * 详情
	 */
	@GetMapping("/detail")
	public R<BaifenhuiNotice> detail(BaifenhuiNoticeDTO dto) {
		BaifenhuiNotice detail = baifenhuiNoticeService.getOne(dto);
		return R.data(detail);
	}

	/**
	 * 分页 
	 */
	@GetMapping("/page")
	public R<IPage<BaifenhuiNotice>> page(BaifenhuiNoticeDTO dto) {
		IPage<BaifenhuiNotice> pages = baifenhuiNoticeService.page(dto);
		return R.data(pages);
	}
	/**
	 * 不分页 
	 */
	@GetMapping("/list")
	public R<List<BaifenhuiNotice>> list(BaifenhuiNoticeDTO dto) {
		List<BaifenhuiNotice> list = baifenhuiNoticeService.list(dto);
		return R.data(list);
	}

	/**
	 * 新增 
	 */
	@PostMapping("/save")
	public R save(@RequestBody BaifenhuiNoticeDTO dto) {
		return R.data(baifenhuiNoticeService.save(dto));
	}

	/**
	 * 修改 
	 */
	@PutMapping("/update")
	public R update(@RequestBody BaifenhuiNoticeDTO dto) {
		return R.data(baifenhuiNoticeService.updateById(dto));
	}

}
